﻿using Newtonsoft.Json;
using System;
using System.Text.Json.Serialization;

namespace ThresholdAssistant.DataContract.Param
{
    /// <summary>
    /// 标准接口请求参数
    /// </summary>
    [Serializable]
    public class ProtocolContractParam
    {
        /// <summary>
        /// 操作结果
        /// </summary>
        [JsonProperty("success"), JsonPropertyName("success")]
        public bool Success { get; set; }

        /// <summary>
        /// 错误信息，成功将返回空
        /// </summary>
        [JsonProperty("message"), JsonPropertyName("message")]
        public string Message { get; set; }
        /// <summary>
        /// 机器人QQ号
        /// </summary>
        [JsonProperty("robot_id"), JsonPropertyName("robot_id")]
        public string RobotId { get; set; }

        /// <summary>
        /// 业务流水号
        /// </summary>
        [JsonProperty("serial_no"), JsonPropertyName("serial_no")]
        public string SerialNo { get; set; } = Guid.NewGuid().ToString("N").ToUpper();
    }

    /// <summary>
    /// 适配器接口请求参数
    /// </summary>
    [Serializable]
    public class ProtocolContractParam<T> : ProtocolContractParam
    {
        /// <summary>
        /// 标准请求参数
        /// </summary>
        [JsonProperty("data"), JsonPropertyName("data")]
        public T Data { get; set; }
    }
}